﻿package mortal.game.view.mainUI.smallMap.view.typeIconDataParser
{
    import Message.BroadCast.*;
    import Message.DB.Tables.*;
    import Message.Public.*;
    import flash.geom.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.scene3D.layer3D.utils.*;
    import mortal.game.scene3D.map3D.util.*;
    import mortal.game.scene3D.player.entity.*;
    import mortal.game.utils.*;
    import mortal.game.view.mainUI.smallMap.view.data.*;

    public class SmallMap_DefenceCopyParser extends Object implements ISmallMapShortMapEntityParser
    {
        public static var instance:SmallMap_DefenceCopyParser = new SmallMap_DefenceCopyParser;

        public function SmallMap_DefenceCopyParser()
        {
            return;
        }// end function

        public function chooseIcon(param1:SShortMapEntity, param2:Array) : void
        {
            var _loc_6:* = undefined;
            var _loc_7:int = 0;
            var _loc_8:TCopy = null;
            var _loc_3:* = new SmallMapTypeIconData();
            var _loc_4:* = GameMapUtil.getPixelPoint(param1.point.x, param1.point.y);
            _loc_3.x = _loc_4.x;
            _loc_3.y = _loc_4.y;
            _loc_3.name = "";
            _loc_3.tips = param1.name;
            var _loc_5:* = Cache.instance.role.entityInfo;
            if (EntityUtil.equal(param1.entityId, _loc_5.entityId))
            {
                return;
            }
            if (param1 is UserPlayer && param1.ownerEntityId)
            {
                return;
            }
            if (param1.entityId.type == EEntityType._EEntityTypePet)
            {
                return;
            }
            if (param1.force == EForce._EForceNeutral || EntityRelationUtil.isOwnerSelfByShortMapEntity(param1))
            {
                if (param1.reserveJs)
                {
                    _loc_6 = JSON.parse(param1.reserveJs);
                }
                _loc_7 = Cache.instance.copy.copyInfo.code;
                _loc_8 = CopyConfig.instance.getCopyInfoByCode(_loc_7);
                if (_loc_6 && _loc_6.defense_summon == "1" || _loc_8 && _loc_8.bossShow && _loc_8.bossShow.indexOf("" + param1.code) != -1)
                {
                    _loc_3.iconName = ImagesConst.MapPoint_greenPoint;
                }
                else
                {
                    return;
                }
            }
            else
            {
                _loc_3.iconName = ImagesConst.MapPoint_MovePoint;
            }
            _loc_3.tips = param1.name;
            param2.push(_loc_3);
            return;
        }// end function

    }
}
